package com.power.ding.model;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.plf.core.common.annotations.FieldEnumText;
import com.plf.core.common.domain.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * 钉钉待办发送实体类
 */

@Entity
@ApiModel(value = "钉钉待办发送")
@Data
@Table(name = "Di_todo")
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
//@IdClass(Di_todo.Di_todoPK.class) 用于复合组件
public class Di_todo extends BaseModel implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @Setter(AccessLevel.NONE)
    @ApiModelProperty(value = "序号")
    private String id;

    @Column(nullable = false)
    @ApiModelProperty(value = "标题")
    private String bt;

    @ApiModelProperty(value = "办理提示")
    private String content;

    @ApiModelProperty(value = "编号/文号")
    private String wh;

    @ApiModelProperty(value = "模块类型")
    private String moduleName;

    @ApiModelProperty(value = "处理方式")
    private String action;

    /**
     * 0普通，1平急，2加急，3特急，4特提
     */
    @Column(nullable = false)
    @ApiModelProperty(value = "紧急程度")
    private String urgent;

    /**
     * 1普通，2重要
     */
    @ApiModelProperty(value = "重要程度")
    private String important;

    @ApiModelProperty(value = "处理链接")
    private String url;

    @Column(nullable = false)
    @ApiModelProperty(value = "发送人id")
    private String sendUserId;

    @Column(nullable = false)
    @ApiModelProperty(value = "发送人姓名")
    private String sendUserName;

    @Column(nullable = false)
    @ApiModelProperty(value = "发送人部门id")
    private String sendDeptId;

    @Column(nullable = false)
    @ApiModelProperty(value = "发送人部门名称")
    private String sendDeptName;

    @Column(nullable = false)
    @ApiModelProperty(value = "接收人id")
    private String receiveUserId;

    @Column(nullable = false)
    @ApiModelProperty(value = "接收人姓名")
    private String receiveUserName;

    @ApiModelProperty(value = "接收人部门id")
    private String receiveDeptId;

    @ApiModelProperty(value = "接收人部门名称")
    private String receiveDeptName;

    @ApiModelProperty(value = "发送时间", example = "2020-10-22 10:03:22")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date sendTime;

    @ApiModelProperty(value = "发送失败错误提示")
    private String sendError;

    @ApiModelProperty(value = "行政复议申请id")
    private String applyid;

    @ApiModelProperty(value = "处理状态")
    private Integer pStatus;

    @ApiModelProperty(value = "处理时间", example = "2020-10-22 10:03:22")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date pTime;

    @ApiModelProperty(value = "完成失败错误提示")
    private String finishError;

    @ApiModelProperty(value = "材料类型")
    private Integer mattype;

    @ApiModelProperty(value = "业务路由")
    private String route;
    /**
     * 处理状态文本
     */
    @Transient
    @FieldEnumText(eum = "St_pstatus", valuefield = "pStatus")
    private String pStatus_text;


    public Map<String, Object> parseMap() {
        Map<String, Object> map = new HashMap<>();
        map.put("id", this.getId());
        map.put("bt", this.getBt());
        map.put("content", this.getContent());
        map.put("wh", this.getWh());
        map.put("moduleName", this.getModuleName());
        map.put("action", this.getAction());
        map.put("urgent", this.getUrgent());
        map.put("important", this.getImportant());
        map.put("url", this.getUrl());
        map.put("sendUserId", this.getSendUserId());
        map.put("sendUserName", this.getSendUserName());
        map.put("sendDeptId", this.getSendDeptId());
        map.put("sendDeptName", this.getSendDeptName());
        map.put("receiveUserId", this.getReceiveUserId());
        map.put("receiveUserName", this.getReceiveUserName());
        map.put("receiveDeptId", this.getReceiveDeptId());
        map.put("receiveDeptName", this.getReceiveDeptName());
        map.put("sendTime", this.getSendTime());
        map.put("sendError", this.getSendError());
        map.put("applyid", this.getApplyid());
        map.put("pStatus", this.getPStatus());
        map.put("pStatus_text", this.getPStatus_text());
        map.put("pTime", this.getPTime());
        map.put("finishError", this.getFinishError());
        map.put("mattype", this.getMattype());
        return map;
    }

    public String getId() {
        return id;
    }

    public void setId(Serializable id) {
        this.id = (String) id;
    }

    public Serializable getPrimaryKey() {
        return id;
        // return new Di_todoPK(id, id2); 用于复合主键，请手动创建内部静态类
    }

    public void setPrimaryKey(Serializable key) {
        this.id = (String) key;

        //Di_todoPK pk = (Di_todoPK) key; 用于复合主键
        //this.id = pk.getId();
        //this.id2 = pk.getId2();
    }

}